package com.yulintu;

/**
 * @author caomin
 * @date 2018/1/4
 * @说明
 */
public class CmThread  implements Runnable{

    private  Integer a;
    public synchronized void method1() throws InterruptedException {
        System.out.println("进入方法一");
        a=100;
        System.out.println("a="+a);
        method2(a);

    }
    public synchronized void method2(int a){
        if (a!=0){
            System.out.println(a);
        }else {
            a=200;
            System.out.println("b="+a);
        }

    }
    @Override
    public void run() {
        try {
            System.out.println("===");
            method1();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
